﻿using LowB.Dao;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace LowB.Controllers
{
    public class AccountController : Controller
    {
        private LowBContext db = new LowBContext();

        // GET: Account
        public ActionResult Index()
        {
            return View();
        }

        // GET: Account/Details/5
        public ActionResult Main()
        {
            return View();
        }

        // GET: Account/Login
        public ActionResult Login()
        {
            return View();
        }

        // GET: Account/AjaxGetJsonData/5
        public JsonResult AjaxGetJsonData()
        {
            var menus = db.Menus.ToList();
            List<object> list = new List<object>();
            list.Add(new
            {
                title = menus[0].MenuName,
                icon = "icon-computer",
                href = "page/main.html",
                spread = false
            });
            list.Add(new
            {
                title = "文章列表",
                icon = "icon-text",
                href = "/Account/NewsList",
                spread = false
            });
            list.Add(new
            {
                title = "系统基本参数",
                icon = "&#xe631;",
                href = "/Account/SysParas",
                spread = false
            });
            list.Add(new
            {
                title = "其他页面",
                icon = "&#xe630;",
                href = "",
                spread = false,
                children = new List<object> {
                   new{ title = "404页面",
                    icon = "&#xe61c;",
                    href = "page/main.html",
                    spread = false },
                   new{ title = "报表页面",
                    icon = "&#xe629;",
                    href = "page/main.html",
                    spread = false },
                   new{ title = "登录页面",
                    icon = "&#xe6fc;",
                    href = "/Account/Login",
                    spread = false }
                }
            });
            return Json(list, JsonRequestBehavior.AllowGet);
        }

        public ActionResult NewsList()
        {
            return View();
        }

        public ActionResult SysParas()
        {
            return View();
        }

        public ActionResult SysPara11s()
        {
            return View();
        }

        // POST: Account/Edit/5
        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        // GET: Account/Delete/5
        public ActionResult Delete(int id)
        {
            return View();
        }

        // POST: Account/Delete/5
        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
